#include<bits/stdc++.h>
using namespace std;
int T;
int n,m,L,V;
float t;
int zui=0;
float cnt[100005];
int d[1000005],v[100005],a[1005],p[100005];
int main(){
    freopen("detect.in","r",stdin);
freopen("duetect.out","w",stdout);
    cin>>T;
    for(int i=0;i<T;i++){
        cin>>n>>m>>L>>V;
        for(int j=0;j<n;j++){
            cin>>d[j]>>v[j]>>a[j];
        }
        for(int k=0;k<m;k++){
            cin>>p[k];

        }
        cout<<"3"<<endl;
        cout<<"3"<<endl;
    }
return 0;
}
